﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreLibrary
{
    public enum TierLevel
    {
        Great = 3,
        Good = 1,
        Neutral = 0,
        Bad = -1,
        Terrible = -3,
    }

    public static class TierLevelHelper
    {
        public static int GetTierValue(TierLevel level)
        {
            return (int)level;
        }

        public static TierLevel AdjustTier(TierLevel level, TierLevel adjustTo)
        {
            if ( level != TierLevel.Great && adjustTo == TierLevel.Good )
            {
                switch (level)
                {
                    case TierLevel.Good:
                        return TierLevel.Great;
                    case TierLevel.Neutral:
                        return TierLevel.Good;
                    case TierLevel.Bad:
                        return TierLevel.Neutral;
                    case TierLevel.Terrible:
                        return TierLevel.Bad;
                    default:
                        break;
                }
            }

            if ( level != TierLevel.Great && adjustTo == TierLevel.Great )
            {
                switch (level)
                {
                    case TierLevel.Good:
                        return TierLevel.Great;
                    case TierLevel.Neutral:
                        return TierLevel.Great;
                    case TierLevel.Bad:
                        return TierLevel.Good;
                    case TierLevel.Terrible:
                        return TierLevel.Neutral;
                    default:
                        break;
                }
            }

            if (level != TierLevel.Terrible && adjustTo == TierLevel.Bad)
            {
                switch (level)
                {
                    case TierLevel.Great:
                        return TierLevel.Good;
                    case TierLevel.Good:
                        return TierLevel.Neutral;
                    case TierLevel.Neutral:
                        return TierLevel.Bad;
                    case TierLevel.Bad:
                        return TierLevel.Terrible;
                    default:
                        break;
                }
            }

            if (level != TierLevel.Terrible && adjustTo == TierLevel.Terrible)
            {
                switch (level)
                {
                    case TierLevel.Great:
                        return TierLevel.Neutral;
                    case TierLevel.Good:
                        return TierLevel.Bad;
                    case TierLevel.Neutral:
                        return TierLevel.Terrible;
                    case TierLevel.Bad:
                        return TierLevel.Terrible;
                    default:
                        break;
                }
            }

            return level;
        }
    }
}
